<template>
  <div>
    登录页面
    <div>
      <h3>router路由实例的push方法和replace方法</h3>
      <button @click="handlePshClick">push跳转到商品页面</button>
      <br /><br />
      <button @click="handleReplaceClick">replace跳转到商品页面</button>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
// 路由实例
const router = useRouter();
const handlePshClick = () => {
  // 点击跳转到商品页面
  router.push({
    // 跳转的目标路由
    // query传参
    path: "/goods",
    query: {
      id: "202020",
    },

    // // params传参
    // name: "goods",
    // params: {
    //   id: "22222",
    // },
  });
};
const handleReplaceClick = () => {
  // 点击跳转到商品页面
  router.replace({
    // 跳转的目标路由
    path: "/goods",
  });
};
</script>

<style lang="scss" scoped></style>
